<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://lib.baomitu.com/jquery/3.4.1/jquery.min.js"></script>

</head>
<body>
<h3>演示如何访问 Local Datetime 字段</h3>
<input type="date" id="myLocalDate" min=Dat>
<p>点击按钮来获得 datetime 字段的本地日期和时间。</p>
<button onclick="myFunction()">试一下 </button>
<p id="demo">cc</p>

</body>
<script>
    function myDateFomat(t){
        let date=new Date(t);
        let y=date.getFullYear();
        let m=(date.getMonth()+1).toString().padStart(2,"0");
        let d=date.getDate().toString().padStart(2,"0");
        return y+"-"+m+"-"+d;
    }
</script>
<script>
    $(function () {
        var now = new Date();
        let now1="2021-10-25";
        alert(myDateFomat(now))
        $("#myLocalDate").attr("min",myDateFomat(now));

    })

</script>
<script>
    function myFunction() {
        var x = document.getElementById("myLocalDate").value;
        document.getElementById("demo").innerHTML = x;
    }
</script>
</html>